class Cat:
    def __init__(self, name, age):
        self.name = name
        self.age = age
        self.info = [self.name, self.age]
        self.index = -1

    def getName(self):
        return self.name

    def getAge(self):
        return self.age

    def __iter__(self):
        print("姓名 年龄")
        return self

    def next(self):
        if self.index == len(self.info) - 1:
            raise StopIteration
        self.index += 1
        return self.info[self.index]


if __name__ == '__main__':
    cat = Cat("小花", 2)
    print(cat.getName())
    print(cat.getAge())

    iterator = iter(print, None)
    for i in iterator:
        print(i)
